# Thematic breaks

A line consisting of 0-3 spaces of indentation, followed by a sequence of three or more matching -_, or *characters, each followed optionally by any number of spaces or tabs, forms a thematic break (opens new window).

Example 13

Markdown HTML Demo
***
---
___

<hr />
<hr />
<hr />

Wrong characters:

Example 14

Markdown HTML Demo
+++

<p>+++</p>

Example 15

Markdown HTML Demo
===

<p>===</p>

Not enough characters:

Example 16

Markdown HTML Demo
--
**
__

<p>--
**
__</p>

One to three spaces indent are allowed:

Example 17

Markdown HTML Demo
 ***
  ***
   ***

<hr />
<hr />
<hr />

Four spaces is too many:

Example 18

Markdown HTML Demo
    ***

<pre><code>***
</code></pre>

Example 19

Markdown HTML Demo
Foo
    ***

<p>Foo
***</p>

More than three characters may be used:

Example 20

Markdown HTML Demo
_____________________________________

<hr />

Spaces are allowed between the characters:

Example 21

Markdown HTML Demo
 - - -

<hr />

Example 22

Markdown HTML Demo
 **  * ** * ** * **

<hr />

Example 23

Markdown HTML Demo
-     -      -      -

<hr />

Spaces are allowed at the end:

Example 24

Markdown HTML Demo
- - - -    

<hr />

However, no other characters may occur in the line:

Example 25

Markdown HTML Demo
_ _ _ _ a

a------

---a---

<p>_ _ _ _ a</p>
<p>a------</p>
<p>---a---</p>

It is required that all of the non-whitespace characters (opens new window) be the same. So, this is not a thematic break:

Example 26

Markdown HTML Demo
 *-*

<p><em>-</em></p>

Thematic breaks do not need blank lines before or after:

Example 27

Markdown HTML Demo
- foo
***
- bar

<ul>
<li>foo</li>
</ul>
<hr />
<ul>
<li>bar</li>
</ul>

Thematic breaks can interrupt a paragraph:

Example 28

Markdown HTML Demo
Foo
***
bar

<p>Foo</p>
<hr />
<p>bar</p>

If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a setext heading (opens new window), the interpretation as a setext heading (opens new window) takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break:

Example 29

Markdown HTML Demo
Foo
---
bar

<h2>Foo</h2>
<p>bar</p>

When both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence:

Example 30

Markdown HTML Demo
* Foo
* * *
* Bar

<ul>
<li>Foo</li>
</ul>
<hr />
<ul>
<li>Bar</li>
</ul>

If you want a thematic break in a list item, use a different bullet:

Example 31

Markdown HTML Demo
- Foo
- * * *

<ul>
<li>Foo</li>
<li>
<hr />
</li>
</ul>